package com.nino.services.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import utils.QueryParam;

import com.nino.bean.DelegateBean;
import com.nino.bean.FilmTypeBean;
import com.nino.bean.FlawBean;
import com.nino.bean.IQIBean;
import com.nino.bean.RayModelBean;
import com.nino.bean.RayTypeBean;
import com.nino.bean.TestStandardBean;
import com.nino.bean.TransilluminatorBean;
import com.nino.dao.impl.DelegateDaoImpl;
import com.nino.dao.impl.FilmTypeDaoImpl;
import com.nino.dao.impl.FlawDaoImpl;
import com.nino.dao.impl.IQIDaoImpl;
import com.nino.dao.impl.RayModelDaoImpl;
import com.nino.dao.impl.RayTypeDaoImpl;
import com.nino.dao.impl.TestStandardDaoImpl;
import com.nino.dao.impl.TransilluminatorDaoImpl;
import com.nino.services.BaseService;

@Service
public class BaseServiceImpl implements BaseService {

	@Autowired
	private RayTypeDaoImpl rayTypeDao;

	@Autowired
	private TestStandardDaoImpl TestStandardDao;

	@Autowired
	private RayModelDaoImpl rayModelDao;

	@Autowired
	private FilmTypeDaoImpl filmTypeDao;

	@Autowired
	private IQIDaoImpl iqiDao;

	@Autowired
	private TransilluminatorDaoImpl transilluminatorDao;

	@Autowired
	private FlawDaoImpl flawDao;
	
	@Autowired
	private DelegateDaoImpl delegateDao;

	@Override
	public int saveTestStandard(TestStandardBean bean) {
		return TestStandardDao.save(bean);
	}

	@Override
	public int removeTestStandard(int id) {
		return TestStandardDao.remove(id);
	}

	@Override
	public List<TestStandardBean> queryTestStandard() {
		return TestStandardDao.query();
	}

	@Override
	public TestStandardBean getTestStandard(int id) {
		return TestStandardDao.get(id);
	}

	@Override
	public int saveRayType(RayTypeBean bean) {
		return rayTypeDao.save(bean);
	}

	@Override
	public int removeRayType(int id) {
		return rayTypeDao.remove(id);
	}

	@Override
	public List<RayTypeBean> queryRayType() {
		return rayTypeDao.query();
	}

	@Override
	public RayTypeBean getRayType(int id) {
		return rayTypeDao.get(id);
	}

	@Override
	public int saveRayModel(RayModelBean bean) {
		return rayModelDao.save(bean);
	}

	@Override
	public int removeRayModel(int id) {
		return rayModelDao.remove(id);
	}

	@Override
	public List<RayModelBean> queryRayModel() {
		return rayModelDao.query();
	}

	@Override
	public RayModelBean getRayModel(int id) {
		return rayModelDao.get(id);
	}

	@Override
	public int saveFilmType(FilmTypeBean bean) {
		return filmTypeDao.save(bean);
	}

	@Override
	public int removeFilmType(int id) {
		return filmTypeDao.remove(id);
	}

	@Override
	public List<FilmTypeBean> queryFilmType() {
		return filmTypeDao.query();
	}

	@Override
	public FilmTypeBean getFilmType(int id) {
		return filmTypeDao.get(id);
	}

	@Override
	public int saveIQI(IQIBean bean) {
		return iqiDao.save(bean);
	}

	@Override
	public int removeIQI(int id) {
		return iqiDao.remove(id);
	}

	@Override
	public List<IQIBean> queryIQI() {
		return iqiDao.query();
	}

	@Override
	public IQIBean getIQI(int id) {
		return iqiDao.get(id);
	}

	@Override
	public int saveTransilluminator(TransilluminatorBean bean) {
		return transilluminatorDao.save(bean);
	}

	@Override
	public int removeTransilluminator(int id) {
		return transilluminatorDao.remove(id);
	}

	@Override
	public List<TransilluminatorBean> queryTransilluminator() {
		return transilluminatorDao.query();
	}

	@Override
	public TransilluminatorBean getTransilluminator(int id) {
		return transilluminatorDao.get(id);
	}

	@Override
	public int saveFlaw(FlawBean bean) {
		return flawDao.save(bean);
	}

	@Override
	public int removeFlaw(int id) {
		return flawDao.remove(id);
	}

	@Override
	public List<FlawBean> queryFlaw() {
		return flawDao.query();
	}

	@Override
	public FlawBean getFlaw(int id) {
		return flawDao.get(id);
	}

	@Override
	public int saveDelegate(DelegateBean bean) {
		return delegateDao.save(bean);
	}

	@Override
	public int removeDelegate(int id) {
		return delegateDao.remove(id);
	}

	@Override
	public List<DelegateBean> queryDelegate(String content) {
		
		if(content != null && !"".equals(content)) {
			List<QueryParam> list = new ArrayList<QueryParam>();
			list.add( new QueryParam("content", QueryParam.LIKE, content) );
			return delegateDao.query(list);
		}
		return delegateDao.query();
	}
	
	
	@Override
	public DelegateBean getDelegate(int id) {
		return delegateDao.get(id);
	}

	

}
